package com.example.tests;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
import org.testng.Assert;
import org.testng.annotations.Test;
import com.example.fw.Folders;

public class TestFolderRemoval extends TestBase {

	@Test
	public void testFolderCreation() {
		Folders oldFolders = app.getFolderHelper().getFolders();
		int index = oldFolders.getRandomFolderIndex();
		if (index > 0) {
			assertThat(app.getFolderHelper().removeFolder(index),is(nullValue()));
			Folders newFolders = app.getFolderHelper().getFolders();
			assertThat(newFolders, equalTo(oldFolders.without(index)));
    } else {
    	Assert.fail("There are less than two folders in application!");
    }
	}

}
